INCLUDE(CMakeModules/CPM.cmake)

CPMAddPackage(
        NAME doctest
        GITHUB_REPOSITORY onqtam/doctest
        GIT_TAG 2.4.6
)


MACRO(ADD_TWEAK_TEST _NAME_TARGET _NAME_FILE)
    ADD_EXECUTABLE(${_NAME_TARGET} ${_NAME_FILE})
    SET_TARGET_PROPERTIES(${_NAME_TARGET} PROPERTIES CXX_STANDARD 17)
    TARGET_LINK_LIBRARIES(${_NAME_TARGET} PRIVATE doctest)
    ADD_TEST(NAME ${_NAME_TARGET} COMMAND ${_NAME_TARGET})
    TARGET_INCLUDE_DIRECTORIES(${_NAME_TARGET} PUBLIC
            $<BUILD_INTERFACE:${TWEAK_ROOT_DIR}/Include/>)
ENDMACRO()

ADD_TWEAK_TEST(Test.Unit.BinaryTree Unit/TestBinaryTree.cpp)
ADD_TWEAK_TEST(Test.Unit.QueType Unit/TestQueue.cpp)